<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="div1">我是一个div</div>
</body>
<script>
  window.id = 'window';
  document.getElementById('div1').onclick = function () {
    alert(this.id); // div1
    console.log(this) // <div id="div1">我是一个div</div>
    var callback = function () {
      console.log(this)//Window {window: Window, self: Window, document: document, name: "", location: Location, …}
      alert(this.id); // window，想此 this 指向 div
    }
    callback();
  }
  var a = function (){
    console.log(this)
  }
  a();
</script>
</html>